<template>
  <uni-popup ref="popup" type="center" :mask-click="false">
    <view class="MsgDialog-container" v-if="msg">
      <image src="http://down.qwdata.vip/app_icon/1679257246106" class="bg-img"></image>
      <view class="close-btn" @click="close">
        <image src="../static/guanbi@3x.png" class="icon"></image>
      </view>
      <view class="content">{{msg.content}}</view>
      <view class="btns-container">
        <view :class="[msg.confirmText?'double-btn':'single-btn']" v-if="msg.cancelText" @click="close">{{
            msg.cancelText || '不用了'
          }}
        </view>
        <view :class="[msg.cancelText?'double-btn':'single-btn', 'primary']" v-if="msg.confirmText" @click="toDetail">{{
            msg.confirmText || '续费开通'
          }}
        </view>
      </view>
    </view>
  </uni-popup>
</template>

<script>

export default {
  name: 'VIPExpiredDialog',
  data() {
    return {
      msg: null
    }
  },
  mounted() {
  },
  destroyed() {
  },
  methods: {
    open(msg) {
      this.msg = msg
      this.$refs.popup.open()
    },
    toDetail() {
      if (this.msg.href) {
        uni.navigateTo({
          url: this.msg.href
        });
      }
      this.close()
    },
    close() {
      this.$refs.popup.close()
    }
  }
}
</script>

<style scoped lang='scss'>
.MsgDialog-container {
  position: relative;
  padding-top: 1px;

  .bg-img {
    width: 630rpx;
    height: 712rpx;
  }

  .content {
    position: absolute;
    left: 0;
    right: 0;
    top: 170rpx;
    text-align: center;
    color: #0B0B0B;
    font-size: 14px;
  }

  .btns-container {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
  }

  .single-btn {
    height: 108rpx;
    background-color: #DBDBDB;
    margin-bottom: 64rpx;
    margin-left: 114rpx;
    margin-right: 114rpx;
    width: 402rpx;
    font-size: 17px;
    color: #fff;
    border-radius: 54rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    &.primary {
      background-color: #E3C898;
      color: #0B0B0B;
    }
  }



  .double-btn {
    height: 100rpx;
    margin-left: 40rpx;
    margin-right: 40rpx;
    background-color: #DBDBDB;
    border-radius: 60rpx;
    flex: 1;
    display: flex;
    font-size: 16px;
    color: #fff;
    justify-content: center;
    align-items: center;
    margin-bottom: 64rpx;
    font-weight: bold;

    &:first-child {
      margin-right: 0;
    }
    &.primary {
      background-color: #E3C898;
      color: #0B0B0B;
    }
  }

  .close-btn {
    position: absolute;
    right: 0;
    top: 0;
    padding: 40rpx;

    .icon {
      width: 24rpx;
      height: 24rpx;
    }
  }
}
</style>
